package com.ywz.project.system.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ywz.common.ResultResp;
import com.ywz.project.base.system.entity.TSysMenu;
import com.ywz.project.base.system.service.TSysMenuService;
import com.ywz.project.system.dto.req.MenuPageReq;
import com.ywz.project.system.service.SysMenuApiService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class SysMenuApiServiceImpl implements SysMenuApiService {
    @Resource
    private TSysMenuService tSysMenuService;

    @Override
    public ResultResp getMenuPage(MenuPageReq req) {
        LambdaQueryWrapper<TSysMenu> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(TSysMenu::getIsDeleted, 0);
        Page<TSysMenu> page = new Page<>(req.getPageNum(), req.getPageSize());
        return ResultResp.success(tSysMenuService.page(page, wrapper));
    }
}
